package com.dayu.demo.pojo;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Map;
import java.math.BigDecimal;
import com.vecspace.data.model.RowMapper;
import com.vecspace.data.model.IdEntity;
import com.vecspace.dicttable.DictAll;
import org.hibernate.annotations.Polymorphism;
import org.hibernate.annotations.PolymorphismType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Transient;
import com.vecspace.data.model.IDataLockState;


/** 项目信息
 * @template dayu-code-builder
 * @author user
 * @reviewer 
 * @createTime 2021-11-25 17:22:27
 * @version 1.0
 */
@Entity
@Polymorphism(type = PolymorphismType.EXPLICIT)
@Table(name = "T_DEMO_PROJECT")
public class Project implements IdEntity, IDataLockState, java.io.Serializable {

    public Project(){
    }
    
    private static final long serialVersionUID = 10013L;

    /** ID */
    private Long id;
    /** 项目简称 */
    private String name;
    /** 项目全称 */
    private String fullName;
    /** 项目编码 */
    private String code;
    /** 项目地点 */
    private String address;
    /** 经度 */
    private BigDecimal lng;
    /** 纬度 */
    private BigDecimal lat;
    /** 项目类型 */
    private String projectKind;
    /** 销售经理 */
    private Long salesManager;
    /** 所在行政区 */
    private String districtCode;
    /** 项目经理 */
    private Long projectManager;
    /** 立项日期 */
    private LocalDate initialDate;
    /** 中标日期 */
    private LocalDate bidDate;
    /** 合同金额 */
    private BigDecimal contractAmount;
    /** 项目周期 */
    private Integer projectMonths;
    /** 项目建设内容 */
    private String projectContent;
    /** 项目状态 */
    private String projectStatus;
    /** 项目评分 */
    private Integer projectScore;
    /** 业主单位 */
    private String projectOwner;
    /** 联系人姓名 */
    private String linkMan;
    /** 联系人电话 */
    private String linkPhone;
    /** 是否中止 */
    private Boolean abort;
    /** 备注 */
    private String remarks;
    /** 顺序号 */
    private Integer ordnum;
    /** 租户ID */
    private Long tenantId;
    /** 锁定状态 */
    private Integer rowLock;
    /** 记录创建时间 */
    private LocalDateTime createTime;
    /** 记录创建人ID */
    private String createUser;

    /**项目类型 字典码*/
    public static final String ProjectKindCode = "DM-DEMO-005";
    /**项目类型*/
    @Transient
    @Column(name = "PROJECT_KIND")
    public String getProjectKindCaption(){
        return DictAll.getCachedItemName(ProjectKindCode, projectKind);
    }

    /**所在行政区 字典码*/
    public static final String DistrictCodeCode = "DM-DEMO-003";
    /**所在行政区*/
    @Transient
    @Column(name = "DISTRICT_CODE")
    public String getDistrictCodeCaption(){
        return DictAll.getCachedItemName(DistrictCodeCode, districtCode);
    }

    /**项目状态 字典码*/
    public static final String ProjectStatusCode = "DM-DEMO-007";
    /**项目状态*/
    @Transient
    @Column(name = "PROJECT_STATUS")
    public String getProjectStatusCaption(){
        return DictAll.getCachedItemName(ProjectStatusCode, projectStatus);
    }


/****************************** getter setter *******************************************/


    /**ID*/
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "ID")
    public Long getId(){
        return id;
    }

    /**ID*/
    public void setId(Long value){
        this.id = value;
    }

    /**项目简称*/
    @Column(name = "NAME_")
    public String getName(){
        return name;
    }

    /**项目简称*/
    public void setName(String value){
        this.name = value;
    }

    /**项目全称*/
    @Column(name = "FULL_NAME")
    public String getFullName(){
        return fullName;
    }

    /**项目全称*/
    public void setFullName(String value){
        this.fullName = value;
    }

    /**项目编码*/
    @Column(name = "CODE_")
    public String getCode(){
        return code;
    }

    /**项目编码*/
    public void setCode(String value){
        this.code = value;
    }

    /**项目地点*/
    @Column(name = "ADDRESS")
    public String getAddress(){
        return address;
    }

    /**项目地点*/
    public void setAddress(String value){
        this.address = value;
    }

    /**经度*/
    @Column(name = "LNG")
    public BigDecimal getLng(){
        return lng;
    }

    /**经度*/
    public void setLng(BigDecimal value){
        this.lng = value;
    }

    /**纬度*/
    @Column(name = "LAT")
    public BigDecimal getLat(){
        return lat;
    }

    /**纬度*/
    public void setLat(BigDecimal value){
        this.lat = value;
    }

    /**项目类型*/
    @Column(name = "PROJECT_KIND")
    public String getProjectKind(){
        return projectKind;
    }

    /**项目类型*/
    public void setProjectKind(String value){
        this.projectKind = value;
    }

    /**销售经理*/
    @Column(name = "SALES_MANAGER")
    public Long getSalesManager(){
        return salesManager;
    }

    /**销售经理*/
    public void setSalesManager(Long value){
        this.salesManager = value;
    }

    /**所在行政区*/
    @Column(name = "DISTRICT_CODE")
    public String getDistrictCode(){
        return districtCode;
    }

    /**所在行政区*/
    public void setDistrictCode(String value){
        this.districtCode = value;
    }

    /**项目经理*/
    @Column(name = "PROJECT_MANAGER")
    public Long getProjectManager(){
        return projectManager;
    }

    /**项目经理*/
    public void setProjectManager(Long value){
        this.projectManager = value;
    }

    /**立项日期*/
    @Column(name = "INITIAL_DATE")
    public LocalDate getInitialDate(){
        return initialDate;
    }

    /**立项日期*/
    public void setInitialDate(LocalDate value){
        this.initialDate = value;
    }

    /**中标日期*/
    @Column(name = "BID_DATE")
    public LocalDate getBidDate(){
        return bidDate;
    }

    /**中标日期*/
    public void setBidDate(LocalDate value){
        this.bidDate = value;
    }

    /**合同金额*/
    @Column(name = "CONTRACT_AMOUNT")
    public BigDecimal getContractAmount(){
        return contractAmount;
    }

    /**合同金额*/
    public void setContractAmount(BigDecimal value){
        this.contractAmount = value;
    }

    /**项目周期*/
    @Column(name = "PROJECT_MONTHS")
    public Integer getProjectMonths(){
        return projectMonths;
    }

    /**项目周期*/
    public void setProjectMonths(Integer value){
        this.projectMonths = value;
    }

    /**项目建设内容*/
    @Column(name = "PROJECT_CONTENT")
    public String getProjectContent(){
        return projectContent;
    }

    /**项目建设内容*/
    public void setProjectContent(String value){
        this.projectContent = value;
    }

    /**项目状态*/
    @Column(name = "PROJECT_STATUS")
    public String getProjectStatus(){
        return projectStatus;
    }

    /**项目状态*/
    public void setProjectStatus(String value){
        this.projectStatus = value;
    }

    /**项目评分*/
    @Column(name = "PROJECT_SCORE")
    public Integer getProjectScore(){
        return projectScore;
    }

    /**项目评分*/
    public void setProjectScore(Integer value){
        this.projectScore = value;
    }

    /**业主单位*/
    @Column(name = "PROJECT_OWNER")
    public String getProjectOwner(){
        return projectOwner;
    }

    /**业主单位*/
    public void setProjectOwner(String value){
        this.projectOwner = value;
    }

    /**联系人姓名*/
    @Column(name = "LINK_MAN")
    public String getLinkMan(){
        return linkMan;
    }

    /**联系人姓名*/
    public void setLinkMan(String value){
        this.linkMan = value;
    }

    /**联系人电话*/
    @Column(name = "LINK_PHONE")
    public String getLinkPhone(){
        return linkPhone;
    }

    /**联系人电话*/
    public void setLinkPhone(String value){
        this.linkPhone = value;
    }

    /**是否中止*/
    @Column(name = "ABORT_")@org.hibernate.annotations.Type(type="org.hibernate.type.NumericBooleanType")
    public Boolean getAbort(){
        return abort;
    }

    /**是否中止*/
    public void setAbort(Boolean value){
        this.abort = value;
    }

    /**备注*/
    @Column(name = "REMARKS")
    public String getRemarks(){
        return remarks;
    }

    /**备注*/
    public void setRemarks(String value){
        this.remarks = value;
    }

    /**顺序号*/
    @Column(name = "ORDNUM")
    public Integer getOrdnum(){
        return ordnum;
    }

    /**顺序号*/
    public void setOrdnum(Integer value){
        this.ordnum = value;
    }

    /**租户ID*/
    @JsonIgnore(true)
    @Column(name = "TENANT_ID")
    public Long getTenantId(){
        return tenantId;
    }

    /**租户ID*/
    public void setTenantId(Long value){
        this.tenantId = value;
    }

    /**锁定状态*/
    @Column(name = "ROW_LOCK")
    public Integer getRowLock(){
        return rowLock;
    }

    /**锁定状态*/
    public void setRowLock(Integer value){
        this.rowLock = value;
    }

    /**记录创建时间*/
    @JsonIgnore(true)
    @Column(name = "CREATE_TIME")
    public LocalDateTime getCreateTime(){
        return createTime;
    }

    /**记录创建时间*/
    public void setCreateTime(LocalDateTime value){
        this.createTime = value;
    }

    /**记录创建人ID*/
    @JsonIgnore(true)
    @Column(name = "CREATE_USER")
    public String getCreateUser(){
        return createUser;
    }

    /**记录创建人ID*/
    public void setCreateUser(String value){
        this.createUser = value;
    }

    public void parseFrom(Map<String, Object> row){
        RowMapper rowMapper = new RowMapper(row);
        this.id = rowMapper.getLong("ID");
        this.name = rowMapper.getString("NAME_");
        this.fullName = rowMapper.getString("FULL_NAME");
        this.code = rowMapper.getString("CODE_");
        this.address = rowMapper.getString("ADDRESS");
        this.lng = rowMapper.getBigDecimal("LNG");
        this.lat = rowMapper.getBigDecimal("LAT");
        this.projectKind = rowMapper.getString("PROJECT_KIND");
        this.salesManager = rowMapper.getLong("SALES_MANAGER");
        this.districtCode = rowMapper.getString("DISTRICT_CODE");
        this.projectManager = rowMapper.getLong("PROJECT_MANAGER");
        this.initialDate = rowMapper.getLocalDate("INITIAL_DATE");
        this.bidDate = rowMapper.getLocalDate("BID_DATE");
        this.contractAmount = rowMapper.getBigDecimal("CONTRACT_AMOUNT");
        this.projectMonths = rowMapper.getInteger("PROJECT_MONTHS");
        this.projectContent = rowMapper.getString("PROJECT_CONTENT");
        this.projectStatus = rowMapper.getString("PROJECT_STATUS");
        this.projectScore = rowMapper.getInteger("PROJECT_SCORE");
        this.projectOwner = rowMapper.getString("PROJECT_OWNER");
        this.linkMan = rowMapper.getString("LINK_MAN");
        this.linkPhone = rowMapper.getString("LINK_PHONE");
        this.abort = rowMapper.getBoolean("ABORT_");
        this.remarks = rowMapper.getString("REMARKS");
        this.ordnum = rowMapper.getInteger("ORDNUM");
        this.tenantId = rowMapper.getLong("TENANT_ID");
        this.rowLock = rowMapper.getInteger("ROW_LOCK");
        this.createTime = rowMapper.getLocalDateTime("CREATE_TIME");
        this.createUser = rowMapper.getString("CREATE_USER");
    }

    @Override
    public boolean equals(Object obj) {
        if(obj == null)return false;
        if(id == null)return false;
        Project other = (Project)obj;
        return id.equals(other.id);
    }

    @Override
    public int hashCode() {
        if(id == null)return 0;
        return id.hashCode();
    }
}
